<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>history模式</title>
    <script src="../vue.js"></script>
    <script src="../vue-router.js"></script>

</head>

<body>
    <div id="app">
        <h2>history模式</h2>
        <p>
            <router-link to="/foo">go to foo</router-link>
            <router-link to="/bar">go to bar</router-link>
        </p>
        <router-view></router-view>
    </div>
    <script>
        const Foo = {
            template:'<p>foo</p>'
        }
        const Bar = {
            template:'<p>bar</p>'
        }
        const router = new VueRouter({
            mode:'history',
            routes:[
                {path:'/foo',component:'Foo'},
                {path:'/bar',component:'Bar'}
             ]
        })
        const app = new Vue({
            router
        }).$mount('#app');

    </script>
</body>

</html>